package mystatic.src.LT.IChoice;

import mystatic.src.LT.Book.Book;
import mystatic.src.LT.Book.BookList;

import java.util.Scanner;

public class Find implements IChoice {
    @Override
    public void work(BookList bookList) {
        System.out.println("您正在访问查找图书界面");
        System.out.println("请输入您需要查找的图书的名字");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        for(int i=0;i< bookList.getCnt();i++){
            Book books=bookList.getBook(i);
            if(books.getTitle().equals(name)){
                System.out.println(books);
                return;
            }
        }
        System.out.println("未找到您需要查找的书名");
    }
}
